Computer generated images are created from models of objects. It is desirable that the object depicted in a computer generated image resemble the real object to the maximum extent possible. In some instances, the real object specularly reflects light. That is, when viewed at one or more angles, the object reflects light directly from a light source to the viewer. This specularly reflected light appears as a shiny area on the surface of the object.
As an example, when light is projected onto the outer waxy surface of an apple, at one or more angles the light is directly reflected from a source to the viewer and appears as a shiny spot on the apple. In order to graphically portray the image of an apple, it is desirable to display the "shiny spot" on the image of the apple which one would see if viewing the apple in real life.
One method for modeling the specular reflection associated with an object is to utilize a modified version of Gouraud shading. This method will be described with reference to FIG. 1.
First, the surface to be imaged is divided into a number of polygons, such as triangles, the polygons having common vertices. Vectors normal to the surface N.sub.1, N.sub.2, N.sub.3 are calculated at each vertex V.sub.1, V.sub.2, V.sub.3. Using these normal vectors, the light intensity I.sub.1, I.sub.2, I.sub.3 at each vertex V.sub.1, V.sub.2, V.sub.3 is calculated with a light intensity equation. One such equation which accounts for the light intensity from ambient, diffuse and specular components is the equation I=I.sub.a *k.sub.a+I.sub.i *[k.sub.d (L.cndot.N)+k.sub.s (R.cndot.V).sup.n ].
In this equation, I.sub.a *k.sub.a represents the ambient light intensity component and k.sub.d (L.cndot.N) is the diffuse light intensity component. These components, while not necessary to the calculation of the specularly reflected light component, are instrumental in generating an image which accounts for light which impinges on the object from a variety of sources (the ambient component) and the light which impinges on the object from a particular source and is diffusely reflected (the diffuse component). In this portion of the equation, the ambient intensity component is dependent upon the ambient light intensity I.sub.a, while the diffuse component is dependent upon the intensity I.sub.i, of a particular light source. The term k.sub.s (R.cndot.V).sup.n is the specularly reflected light intensity component, which is also dependent upon the light source intensity I.sub.i.
In the equation, k.sub.a, k.sub.d and k.sub.s are the ambient, diffuse and specular reflection constants. The value of these constants depends upon a number of factors, such as the texture of the surface which is being modeled or imaged.
L is the light vector, V is the viewing vector and R is the reflection vector. One arrangement of the inter-relationship of the L, V and R vectors is illustrated in FIG. 2. In accordance with this light intensity equation, the dot product of the vectors R and V (i.e. R.cndot.V) represents the cosine of the angle between the two vectors. The R vector may be calculated in accordance with the equation R=2* (N.cndot.L)*N-L. Likewise, the dot product of the vectors L and N (i.e. L.cndot.N) represents the cosine of the angle between these two vectors.
In accordance with the Gouraud method, once the intensity of the light is calculated at each vertex of the polygon, the intensity of the light is then linearly interpolated to each other point on the polygon (each point corresponding to a display pixel). For example, referring again to FIG. 1, the light intensity I.sub.4 at a point P.sub.4 along a scan line SL is interpolated by first interpolating the light intensities I.sub.5 and I.sub.6 at the intersection of the scan line with the polygon edges at points P.sub.5 and P.sub.6. The intensities I.sub.5 and I.sub.6 are interpolated from the intensities I.sub.1 and I.sub.3, and I.sub.2 and I.sub.3 at the vertices, respectively. The intensity I.sub.4 is then interpolated from the light intensities I.sub.5 and I.sub.6.
This method is discussed in Gouraud, "Continuous Display of Curved Surfaces," Ph. D. dissertation, Department of Computer Science, University of Utah, Salt Lake City, June 1971. This method is also discussed generally in "Fundamentals of Interactive Computer Graphics" by Foley, Van Dam and Addison-Wesley, 1984.
This method of calculating the specularly reflected light component has several problems. A first problem is that if no specular reflection component is present at a vertex of the polygon, then no specular reflection component will be yielded anywhere in that portion of the image derived from that polygon. This is the case since the specular component at all non-vertex points of the polygon are interpolated from the specular component at the vertices. In addition, this method may result in exaggerated intensity changes at discontinuities. As a result, the imaged object may not appear as the actual object would appear.
Another problem with this method is that the specular component is based upon the dot product of the R and V vectors. In other words, the specular component is based upon the cosine of the angle between these vectors. As is well known, the cosine function changes little at angles near 0 degrees. On the other hand, specular reflection only occurs at angles near 0 degrees. So that the specular function transitions smoothly from angles near 0 degrees to larger angles where no reflection is visible, the differences in the cosine values at these angles must be exaggerated. This can be accomplished by raising the cosine value by a power n. On the other hand, this makes the computation more demanding, and increases the error associated with calculation of the specular component.
Another method of modeling or calculating the specular reflection is known as the Phong method. In accordance with this method, a normal vector is calculated at each vertex of the polygon. The normal vector at other points of the polygon are interpolated from these vertex normals. The normal vector at a particular point or pixel is then normalized, i.e. turned into a unit vector., and the resulting normalized vector is used in the above-referenced light intensity calculation.
In the example illustrated in FIG. 1, the Phong method requires the calculation of the normal vectors N.sub.5 and N.sub.6 at points P.sub.5 and P6, as interpolated from the normal vectors at points N.sub.1 and N.sub.3, and N.sub.2 and N.sub.3, respectively. Then, the normal vector N.sub.4 at point P.sub.4 is calculated from the normal vectors N.sub.5 and N.sub.6. This normal vector N.sub.4 is then normalized (i.e. converted to a unit vector) for use in the light intensity calculation.
This method is discussed in Foley, Van Dam and Addison-Wesley, supra, and in Phong, "Illumination of Computer-Generated Images," Ph.D. dissertation, Department of Electrical Engineering, University of Utah, July 1973.
There are several problems with the Phong method. First, the normal vector must be calculated at each point or pixel. In addition, this normal vector must be converted to a unit vector. The transformation of the normal vector into a unit normal vector requires the calculation of the reciprocal square root of the terms of the vector. These calculations are very demanding in terms of computational effort and time. In addition, the dot product of the R and V vectors must still be raised to an arbitrary power n. That this calculation must be done at each point or pixel also increases the calculation demands. As a result, the Phong method is more interesting from a theoretical perspective than actually useful when considering the computational demands of the method.
A problem associated with use of either of the above-identified models is that the calculation of the specular reflection component requires calculation of the reflection vector R. Because the reflection vector R may change at each point of a surface, the above-equations require the reflection vector R to be re-calculated at each individual point or pixel. Once again, this arrangement is computationally demanding.
As one attempt to overcome some of the above-stated problems, in the Blinn method of modeling specular highlights, the need for calculating the reflection vector R is eliminated by use of a vector H called the halfway vector. In accordance with this model, the value R.cndot.V is replaced with N.cndot.H, where H is a vector extending from the point halfway between the N and V vectors, i.e. H=(L+V)/2. The value N.cndot.H represents the cosine of the angle .gamma., as illustrated in FIG. 2. This method is discussed in Blinn, "Models of Light Reflection For Computer Synthesized Pictures," SIGGRAPH Proceedings, pages 192-198, July 1977.
When this improvement is applied to the Gouraud shading model, however, the problems associated with light intensity interpolation still exist. If this improvement is applied to the Phong model, the specular component computation is still demanding since the reciprocal square root calculation is still required to normalize the normal vector at the point or pixel under consideration.
A further attempt to provide a less computationally demanding specular reflectivity model exists in which individual calculations of the intensities are avoided by using a second-degree Taylor expansion to approximate Phong shading data. This method is discussed in Bishop & Weiner, "Fast Phong Shading," ACM Vol. 20, No. 4, July 1986, pages 103-106.
This method is still substantially more complex than Gouraud shading, and yet introduces additional approximations as compared to the Phong method.